import { get } from '@/utils/request'

export interface Permission {
    "id": string,
    "name": string,
    "resource_type": string,
    "children": Permission[],
}

export function getMenuPermission(type: string) {
    return new Promise<Permission[]>((resolve, reject) => {
        get<Permission[]>('/api/sys/permissions/list/' + type).then((res) => {
            console.debug('获取菜单权限成功', res);
            resolve(res);
        }).catch((error) => {
            console.error('获取菜单权限失败', error);
            reject(error);
        });
    });
}
